/**  
* @Title: BlogServiceImpl.java 
* @Description:
* @Copyright: Copyright (c) 2018
* @Company:http://www.sinocon.cn
* @author Administrator  
* @date 2018年3月27日  
* @version 1.0  
*/
package com.yuanlinsu.project.blog.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.yuanlinsu.common.PageUtil;
import com.yuanlinsu.project.blog.dao.IBlogMapper;
import com.yuanlinsu.project.blog.entity.Blog;

import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;

/**
 * @Title: BlogServiceImpl
 * @Description:
 * @author:Administrator
 * @date 2018年3月27日
 */
@Service("blogService")
public class BlogServiceImpl implements IBlogService {
	private @Autowired IBlogMapper blogDao;

	/*
	 * (non-Javadoc)
	 * 
	 * <p>Title: getBlogByUser</p>
	 * 
	 * <p>Description: </p>
	 * 
	 * @param u
	 * 
	 * @param argmap
	 * 
	 * @return
	 * 
	 * @see com.yuanlinsu.project.blog.service.IBlogService#getBlogByUser(com.
	 * yuanlinsu.project.system.user.entity.User, java.util.Map)
	 * 
	 */
	@Override
	public List<Blog> getBlogByUser(String uid, Map<String, Object> argmap) {
		PageHelper.startPage(PageUtil.getPage(argmap), PageUtil.getPageSize(argmap));

		List<Blog> selectByWeekendSql = this.blogDao.selectByExample(new Example.Builder(Blog.class)
				.where(WeekendSqls.<Blog>custom().andEqualTo(Blog::getUid, uid)).build());

		return selectByWeekendSql;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * <p>Title: getBlogById</p>
	 * 
	 * <p>Description: </p>
	 * 
	 * @param b
	 * 
	 * @return
	 * 
	 * @see
	 * com.yuanlinsu.project.blog.service.IBlogService#getBlogById(com.yuanlinsu
	 * .project.blog.entity.Blog)
	 * 
	 */
	@Override
	public Blog getBlogById(Blog b) {
		Blog selectOne = this.blogDao.selectOne(b);
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * <p>Title: getBlogByKey</p>
	 * 
	 * <p>Description: </p>
	 * 
	 * @param key
	 * 
	 * @param argmap
	 * 
	 * @return
	 * 
	 * @see
	 * com.yuanlinsu.project.blog.service.IBlogService#getBlogByKey(java.lang.
	 * String, java.util.Map)
	 * 
	 */
	@Override
	public List<Blog> getBlogByKey(String key, Map<String, Object> argmap) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * <p>Title: addBlog</p>
	 * 
	 * <p>Description: </p>
	 * 
	 * @param blog
	 * 
	 * @return
	 * 
	 * @see
	 * com.yuanlinsu.project.blog.service.IBlogService#addBlog(com.yuanlinsu.
	 * project.blog.entity.Blog)
	 * 
	 */
	@Override
	public Blog addBlog(Blog blog) {
		this.blogDao.insert(blog);
		return blog;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * <p>Title: updateBlog</p>
	 * 
	 * <p>Description: </p>
	 * 
	 * @param blog
	 * 
	 * @return
	 * 
	 * @see
	 * com.yuanlinsu.project.blog.service.IBlogService#updateBlog(com.yuanlinsu.
	 * project.blog.entity.Blog)
	 * 
	 */
	@Override
	public Blog updateBlog(Blog blog) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * <p>Title: delBlogById</p>
	 * 
	 * <p>Description: </p>
	 * 
	 * @param bid
	 * 
	 * @return
	 * 
	 * @see com.yuanlinsu.project.blog.service.IBlogService#delBlogById(int)
	 * 
	 */
	@Override
	public int delBlogById(int bid) {
		// TODO Auto-generated method stub
		return 0;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * <p>Title: delBlogByUser</p>
	 * 
	 * <p>Description: </p>
	 * 
	 * @param uid
	 * 
	 * @return
	 * 
	 * @see com.yuanlinsu.project.blog.service.IBlogService#delBlogByUser(int)
	 * 
	 */
	@Override
	public int delBlogByUser(int uid) {
		// TODO Auto-generated method stub
		return 0;
	}

}
